<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="theme/style.css"
	media="screen" />
<title>OES - Add Question</title>
<script type="text/javascript">
function userFocus()
{
	document.fm.question.focus();
}

function check() 
{
	var question,options,correctAnswer,marks;
	question = document.fm.question.value;
	options = document.fm.options.value;
	correctAnswer = document.fm.correctAnswer.value;
	marks = document.fm.marks.value;
	
	if (question.length < 1) 
	{
		alert("You must enter question");
		document.fm.question.focus();
		return false;
	} 
	else if (options.length < 1) 
	{
		alert("You must enter options");
		document.fm.options.focus();
		return false;
	}
	else if (correctAnswer.length < 1) 
	{
		alert("You must enter correct answer.");
		document.fm.correctAnswer.focus();
		return false;
	}
	else if (marks.length < 1) 
	{
		alert("You must enter marks for this question");
		document.fm.marks.focus();
		return false;
	}
	return true;
}
</script>
</head>
<body onload="userFocus()">
	<div id="MainWrapper">
		<jsp:include page="header.jsp" /> 
		<jsp:include page="LeftContainer.jsp" />
		<div id="MainContent">
		<center>
			<h2>Add Question</h2>
		<%
			String sub = request.getParameter("subject");
			int subjectID = Integer.parseInt(sub);
		%>
		<form action='Questions.do' method="post" name="fm">
			<input type="hidden" name="subjectId" value="<%=subjectID%>"/>
			<input type="hidden" name="questionType" value="multiple"/>
			<input type="hidden" name="questionId" value="0"/>
			<input type="hidden" name="CMD" value="add"/>
			<table>
				<thead><b>Add Question</b></thead><br>
				<tr><td>Question:</td><td><input type="text" name="question"/></td></tr>
				<tr><td>Options:</td><td><input type="text" name="options"/>
				<br>(Enter all options separated by "|".)</td></tr>
				<tr><td>Correct Answer:</td><td><input type="text" name="correctAnswer"/></td></tr>
				<tr><td>Marks:</td><td><input type="text" name="marks"/></td></tr>
				<tr><td></td><td><input type="submit" name="submit" value="Submit"/>
				<input type="reset" value="Reset"></td></tr>
			</table>
		</form>
		</center>
			
		</div>
		<jsp:include page="footer.jsp" />
	</div>
</body>
</html>